package com.qf.config;

import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 任务协调中心
 */
@Configuration
public class ZookeeperConfig {


    @Bean
    public CoordinatorRegistryCenter createRegistryCenter() {
        System.setProperty("zookeeper.sasl.client","false");
        CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(new ZookeeperConfiguration("192.168.41.98:2181", "my-job"));
        regCenter.init();
        return regCenter;
    }
}
